package com.yy.wga.common.core.dto;

import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.annotation.JSONField;
import lombok.Data;

import java.util.Objects;

/**
 * api返回公共参数
 * @author lgw
 */
@Data
public class BaseApiDTO {

    @JSONField(name = "errcode")
    private Integer errcode;

    @JSONField(name = "errmsg")
    private String errmsg;

    public boolean isSuccsss() {
        return Objects.equals(errcode, 0);
    }

    public String getRid() {
        if (StrUtil.isNotBlank(errmsg)) {
            return errmsg.replace(" rid: ", "");
        }
        return "";
    }
}
